﻿using System;
using Sustainalytics.Utils;
using Sustainalytics.Utils.Serilog;

namespace Sustainalytics.ProductInvolvement.Service
{
    static class Program
    {

      
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler((obj, exargs) => {

                CommonEventSerilog.Log.Exception((Exception)exargs.ExceptionObject);
                Console.WriteLine(((Exception)exargs.ExceptionObject).ToString());
            });
            if (Environment.UserInteractive)
            {
                // start as console app
                ProgramConsole.Start();
            }
            else
            {
                // start as windows service
                ProgramWindowsService.Start();
            }
        }
    }
}
